﻿namespace MhAdmin.Web.Core;

/// <summary>
/// 用户配置控制器
/// </summary>
[ApiDescriptionSettings(Tag = "用户配置")]
public class UserConfigController : BaseController
{
    private readonly IUserConfigService _userConfigService;

    public UserConfigController(IUserConfigService userConfigService)
    {
        _userConfigService = userConfigService;
    }

    #region Get 请求

    /// <summary>
    /// 获取用户列配置
    /// </summary>
    /// <returns></returns>
    [HttpGet("getColumn")]
    public async Task<dynamic> GetColumnConfig([FromQuery] QueryUserColumnConfigInput input)
    {
        return await _userConfigService.GetColumnConfig(input);
    }

    #endregion Get 请求

    #region Post 请求

    /// <summary>
    /// 编辑列配置
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost("editColumn")]
    [DisplayName("编辑列配置")]
    public async Task UpdateColumnConfig([FromBody] List<UpdateUserColumnConfigInput> input)
    {
        await _userConfigService.UpdateColumnConfig(input);
    }

    /// <summary>
    /// 删除列配置
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost("deleteColumn")]
    [DisplayName("删除列配置")]
    public async Task DeleteColumnConfig([FromBody] List<BaseIdInput> input)
    {
        await _userConfigService.DeleteColumnConfig(input);
    }

    #endregion Post 请求
}